import requests
import pytest



token = ""
@pytest.fixture(scope='session')
def pub_data():
    url = 'https://shopapi-sit.shwoody.com/selectOneShopInto?shopId=1772569367951810560&employeeId=222'
    headers = {
        "Content-Type": "application/json",
        "Authorization":login()
    }
    req = {}
    resp = requests.post(url, headers=headers, json=req)
    res_json = resp.json()
    data={"token":res_json["accessToken"]}
    yield data

def login():
    url = 'https://shopapi-sit.shwoody.com/mult/shopWxLogin'
    headers = {
        "Content-Type": "application/json"
    }
    req = {
        "principal": "leiyh18930989926",
        "credentials": "123456",
        "shopType": "1"
    }
    resp = requests.post(url, headers=headers, json=req)
    res_json = resp.json()
    return res_json["accessToken"]